<?php
namespace app\home\Controller;
use think\Controller;
use think\Db;
class Helpcontent extends Controller
{
    public function index()
    {
        $sql="SELECT * FROM help,user WHERE help.userid=user.userid AND  helpchenge=1";
        $userdata=Db::query($sql);
        $this->assign('userdata',$userdata);
        return $this->fetch();
    }
    public function content()
    {
        $id=input('id');
        $sql="SELECT * FROM help,user WHERE help.userid=user.userid AND help_id={$id}";
        $userdata=Db::query($sql);
        $this->assign('userdata',$userdata);
        return $this->fetch();
    }
    public function addlist()
    {
        $data['help_id']=input('help_id');
        $data['userid']=input('userid');
        if(Db::table('userhelp')->insert($data))
            return ['code'=>1,'message'=>'操作成功'];
        else
            return ['code'=>0,'message'=>'操作失败'];
    }
}